package it.trekker.dataexchange.service;

import android.net.wifi.WifiManager;
import org.teleal.cling.android.AndroidUpnpServiceConfiguration;
import org.teleal.cling.android.AndroidUpnpServiceImpl;
import org.teleal.cling.model.types.ServiceType;
import org.teleal.cling.model.types.UDAServiceType;


public class UPnPDataExchangeService extends AndroidUpnpServiceImpl {

	@Override
	protected AndroidUpnpServiceConfiguration createConfiguration(WifiManager wifiManager) {
		return new AndroidUpnpServiceConfiguration(wifiManager) {

			/* The only purpose of this class is to show you how you'd
              configure the AndroidUpnpServiceImpl in your application: */

			/* 
			 * By default the registry maintainer will run every second and check if there 
			 * is something to do (most of the time there is nothing to do, of course). 
			 * The default Android configuration however has a default sleep interval of 
			 * five seconds, so it is already consuming less background CPU time - while 
			 * your application might be exposed to somewhat outdated information. 
			 * You can further tune this setting by overriding the 
			 * getRegistryMaintenanceIntervalMillis() in the UpnpServiceConfiguration. 
			 * On Android, you have to subclass the service implementation to provide a 
			 * new configuration: 
			 */
			/*@Override
			public int getRegistryMaintenanceIntervalMillis() {
				return 7000;
			}*/
			
			@Override
			public ServiceType[] getExclusiveServiceTypes() {
				return new ServiceType[] {
						new UDAServiceType("DataExchange")
				};
			}

		};
	}

}